home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 12.0 KB | 339 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: FileMakerPro.vu
- #
- # Contains: Quick look test script for FileMaker Pro version 2.0
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.6> 12/8/93 KTA Check to insure dialog is present before attempting to add
- # fields.
- # <1.0.5> 9/30/93 KTA Initialize gFileName prior to gApptitle being updated by
- # launchTwitch().
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib", "StandardFile.Lib", "DA.Lib", "Font.Lib", "UserInterface.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ### Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: ML
- # Description: Sets up the tool palettes for Filemaker Pro. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s tool globals");
- global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
- global kDrawPaletteNum := 1;
-
- global gPaletteList := {
- { #### Start Palette #1 - Draw
- {6,152,64,184,0}, # Location of tab palette relative to the window
- kPalDocWind, # Palette type
- {3,2}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {19,16}, # Offset between tools {h,v}
- 0, # Not used at this time
- 0 # Not used at this time
- } #### End Palette #1
- };
-
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global SelectTool := { 1, 1, "Select", kClick, 0, {0} };
- global TextTool := { 2, 1, "Text", kClick, 0, {0} };
- global LineTool := { 3, 1, "Line", kDrag, 0, {0} };
- global RectangleTool := { 4, 1, "Rectangle", kDrag, 0, {0} };
- global RoundRectTool := { 5, 1, "Round Rect", kDrag, 0, {0} };
- global CircleTool := { 6, 1, "Circle", kDrag, 0, {0} };
-
- global DrawToolList:={ LineTool,
- RectangleTool,
- RoundRectTool,
- CircleTool
- }; # don't include select tool because may move a field
- # don't include text tool because double click required
- # to choose next tool
- global gToolList:= DrawToolList;
- global gWindowInset := {73,42,20,50};
- global gBoundingRect:= {0,0,511,341};
-
- logstr("Initializing font globals for '{global gApptitle}'");
-
- ### font characteristic lists
- global gFontSizeList := {'6','8','9','10','12','14','18','24','36','48','72'};
- global gFontStyleList := {'Bold','Italic','Underline','Outline','Shadow','Condensed','Extended'};
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain Text"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
-
- end; #InitAppGlobals
-
- ################################################################################
- # Name: Views() Author: KTA (x45604)
- # Description: Select the Keyboard eq specified-This is to change views.
- # Applications: Implemented for each app.
- ################################################################################
- task Views() begin
- LogStr( "Changing Views",3);
- selectMenuItem("Preview", "Select");
- selectMenuItem("Layout", "Select");
- end;
-
-
- #########################################################################
- # NewField(FieldName, FieldType)
- #========================================================================
- # Author: KTA
- # Description: Adds field to FileMaker's 'Field Definition' Dialog
- # Parameters: FieldName - Name of Field
- # FieldType - Type of Field
- # Returns: Nothing
- # Examples: NewField();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task NewField(FieldName,FieldType) begin
- IsRadioButton := Match [radioButton t:FieldType w:[window o:1]];
- if (IsRadioButton)
- begin
- select IsRadioButton;
- type k:{FieldName};
- #str:= "Typed '{FieldName}' and selected the '{FieldType}' RadioButton";
- LogStr("Typed '{FieldName}' and selected the '{FieldType}' RadioButton");
- SpecialKey(returnKey, 'Return Key');
- end;
- else begin
- str := ("There was no match for a RadioButton named '{FieldType}'");
- LogStr(str);
- end;
- end;
-
-
- #########################################################################
- # CreateDataBase()
- #========================================================================
- # Author: KTA
- # Description: Creates a FileMaker DateBase
- # Parameters: None
- # Returns: Nothing
- # Examples: CreateDataBase();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task CreateDataBase() begin
- Println "###### Add some Database Fields ######";
- wait(2);
- if not(match [window o:1 s:dialog]!)
- selectMenuItem(12,4); # help to insure dialog where you define fields is present.
- NewField('Name','Text'); # 1st Parameter is FieldName
- NewField('Address','Text'); # 2nd Parameter is FieldType
- NewField('City','Text');
- NewField('State','Text');
- NewField('Zip','Text');
- NewField('Phone','Number');
- NewField('Birth Date','Date');
- NewField('Portrait','Picture');
-
- selectButton('Done');
-
- LogStr("Created a new database",3);
- end;
-
- #########################################################################
- # EnterData()
- #========================================================================
- # Author: KTA
- # Description: Enters Data into FileMaker DateBase
- # Parameters: NumTimes - Number of time through.
- # Returns: Nothing
- # Examples: EnterData();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task EnterData(NumTimes) begin
-
- Println "###### Enter some Data ######";
- whichScrapItem := 0;
- SpecialKey(tabKey, 'tab Key');
-
- for count := 1 to NumTimes
- begin
-
- JohnList := {'John Doe','25 Main St.','San Francisco','CA','95168','657-9876','10-14-58'};
- CalvinList := {'Calvin Hobbes','15680 Beach Blvd.','Santa Cruz','CA','95647','756-6453','03-17-61'};
- WillList := {'Will Clark','1280 Broadway ','Candlestick','CA','95637','213-7645','02-11-65'};
- BruceList:= {'Bruce Wayne', '110 First St','Gotham City', 'NJ', '952145', '(423) 456-4675', '09-05-66'};
-
- DataList :={JohnList, CalvinList, WillList, BruceList};
- numrecords := card(DataList);
-
- for each DataItem in DataList
- begin
-
- TypeList( DataItem, 2, 1 ); #Type all of the DataItems and a TabKey
-
- ####### Different item in Scrap for each DataItem ######
- whichScrapItem := whichScrapItem + 1;
- if (whichScrapItem > 7) # There are 7 items in Default 7.0 Scrapbook
- whichScrapItem := 1;
-
- ScrapBook( whichScrapItem );
- if (whichScrapItem = 1)
- LogStr("Note: Error expected if attempting to paste text. FileMaker does not accept TEXT in the PICT Field",2);
-
- DialogCheck();
- selectMenuItem("New Record", "Edit");
-
- end; # for each DataItem in DataList
-
- LogStr("Entered {numrecords} records",3);
-
- end; # for count := 1 to NumTimes
-
- end;
-
- #########################################################################
- # EnlargePICTField()
- #========================================================================
- # Author: KTA
- # Description: Enlarges the PICT field for this script in the Layout view
- # Parameters: Nothing
- # Returns: Nothing
- # Examples: EnlargePICTField();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task EnlargePICTField() begin
- temp := MouseSpeed(5);
- MoveRelativetoWindow(353,185); #This is used to draw a larger pict box
- click; #in the layout window
- wait(2);
- MoveMouse(130, 80, 0, 1);
- MouseSpeed(Temp);
- end;
-
- #########################################################################
- # FMProSetupDoText()
- #========================================================================
- # Author: ML
- # Description: Initializes FM tool globals
- # Parameters: nada
- # Returns: Nothing
- # Examples: FMProSetupDoText();
- # Assumptions: None
- # Applications: FM Pro
- #========================================================================
- # History:
- #
- #########################################################################
- task FMProSetupDoText()
- begin
- Draw(TextTool);
- end;
-
-
- ################################################################################
- #################### Main Script ####################
- ################################################################################
- script FilemakerPro (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel);
- InitDraw();
- InitFonts();
- global gAppTitle := 'Filemaker Pro';
- global gAppVersion := '2'; # version of app you will be running
- global gFileName := "@!@-{gBuildVers}-{gAppTitle}"; #This is used in SaveAs when saving files
- SuiteStart('FileMakerPro.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gSetupDoText := task FMProSetupDoText;
- InitAppGlobals();
- (*
- *)
- DoSetUpApp('Cancel',-1,,,,,0); # select "Cancel" at launch
-
- SaveAs(gFileName); # name database
-
- CreateDataBase(); # Create
-
- CloseWindow(); # close window
- OpenFile(gLastSavedFile); # SF_Get will open file
-
- selectMenuItem("Layout", "Select"); # Modify default layout
-
- EnlargePICTField(); # Enlarge the PICT Box
-
- DoDraw(); # Test Draw Tools
-
- DoText(); # Test Text
-
- selectMenuItem("Browse", "Select"); # Browse Mode
-
- DoWindow(); # test windows
-
- EnterData(1); # Enter Some Data
-
- Views(); # change views
-
- selectMenuItem("Save A Copy As", "File"); # To Select Save As from the File menu
- selectButton('Cancel'); # Cancel the Standard SF_Put Dialog
-
- selectMenuItem("Save A Copy As", "File"); # To Select Save As from the File menu
- SaveAs(gFileName,0); # To test SF_Put
-
- DoCloseApp(-1); # no save/replace/modify
-
- LogStr("############################# LIMITATIONS: ############################");
- LogStr("NOTE: Scrapbook calls are handled in the EnterData() task");
- LogStr("NOTE: FileMaker Saves Automatically so there is no Save or Revert");
- LogStr("NOTE: Error expected if attempting to paste text. FileMaker does not accept TEXT in the PICT Field",2);
-
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end;
-